#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
//	system("start https://www.lanqiao.cn/problems/4389/learning/");

	int t;
	cin >> t;

	while (t--) {
		int n;
		cin >> n;

		vector<int> a(n), b(n);
		for (int &i : a)	cin >> i;
		for (int &i : b)	cin >> i;

		bool flag = 0;

		for (int i = 0; i < n; i++)
			if (a[i] > b[i]) {
				flag = 1;
				break;
			}

		cout << (flag ? "NO" : "YES") << endl;
	}

	return 0;
}
